const state = {
  pageTabRef: null
}

const mutations = {
  setPageTabRef: (state, ref) => {
    state.pageTabRef = ref
  },
}

const actions = {
  setPageTabRef({ dispatch, state }, ref) {
    state.pageTabRef = ref
  },
  delView ({ commit, state }, path) {
    return new Promise(resolve => {
      resolve();
      setTimeout(() =>{
        commit('setInstantUpdateTime', null, {root: true});
        state.pageTabRef.remove(path, false)
      }, 0);
    })
  },
}

export default {
  namespaced: true,
  state,
  mutations,
  actions
}
